import java.util.Scanner;

public class Main {

    public static String str = " yizhong";

    public static int n;

    public static char[][] arr;

    public static boolean[][] flag;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        n = sc.nextInt();
        arr = new char[n + 1][n + 1];

        for (int i = 1; i < n + 1; i++) {
            String temp = sc.next();
            for (int j = 1; j < n + 1; j++) {
                arr[i][j] = temp.charAt(j - 1);
            }
        }

        flag = new boolean[n + 1][n + 1];

        for (int i = 1; i < n + 1; i++) {
            for (int j = 1; j < n + 1; j++) {
                dfs(i, j, 1);
            }
        }

        for (int i = 1; i < n + 1; i++) {
            for (int j = 1; j < n + 1; j++) {
                if (flag[i][j]) {
                    System.out.print(arr[i][j]);
                } else {
                    System.out.print('*');
                }
            }
            System.out.println();
        }

        sc.close();
    }

    public static boolean dfs(int x, int y, int index) {
        if (x < 1 || x > n || y < 1 || y > n) {
            return false;
        }

        if (arr[x][y] == str.charAt(index)) {
            if (index == 7) {
                flag[x][y] = true;
                return true;
            } else {
                //dfs(n+1,m,no+1)||dfs(n,m-1,no+1)||dfs(n,m+1,no+1)||dfs(n-1,m,no+1)||
                //dfs(n+1,m-1,no+1)||dfs(n+1,m+1,no+1)||dfs(n-1,m-1,no+1)||dfs(n-1,m+1,no+1)
                if (dfs(x - 1, y - 1, index + 1) || dfs(x - 1, y, index + 1) ||
                    dfs(x - 1, y + 1, index + 1) || dfs(x, y - 1, index + 1) ||
                    dfs(x, y + 1, index + 1) || dfs(x + 1, y - 1, index + 1) ||
                    dfs(x + 1, y, index + 1) || dfs(x + 1, y + 1, index + 1)) {
                    flag[x][y] = true;
                    return true;
                } else {
                    return false;
                }
            }
        } else {
            return false;
        }
    }
}
